home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Resources
/
Chat & Communication
/
Digsby build 37
/
digsby_setup.exe
/
lib
/
dns
/
node.pyo
(
.txt
)
< prev
next >
Wrap
Python Compiled Bytecode
|
2008-10-13
|
3KB
|
91 lines
# Source Generated with Decompyle++
# File: in.pyo (Python 2.5)
import StringIO
import dns.rdataset as dns
import dns.rdatatype as dns
import dns.renderer as dns
class Node(object):
__slots__ = [
'rdatasets']
def __init__(self):
self.rdatasets = []
def to_text(self, name, **kw):
s = StringIO.StringIO()
for rds in self.rdatasets:
print >>s, rds.to_text(name, **kw)
return s.getvalue()[:-1]
def __repr__(self):
return '<DNS node ' + str(id(self)) + '>'
def __eq__(self, other):
for rd in self.rdatasets:
if rd not in other.rdatasets:
return False
continue
for rd in other.rdatasets:
if rd not in self.rdatasets:
return False
continue
return True
def __ne__(self, other):
return not self.__eq__(other)
def __len__(self):
return len(self.rdatasets)
def __iter__(self):
return iter(self.rdatasets)
def find_rdataset(self, rdclass, rdtype, covers = dns.rdatatype.NONE, create = False):
for rds in self.rdatasets:
if rds.match(rdclass, rdtype, covers):
return rds
continue
if not create:
raise KeyError
rds = dns.rdataset.Rdataset(rdclass, rdtype)
self.rdatasets.append(rds)
return rds
def get_rdataset(self, rdclass, rdtype, covers = dns.rdatatype.NONE, create = False):
try:
rds = self.find_rdataset(rdclass, rdtype, covers, create)
except KeyError:
rds = None
return rds
def delete_rdataset(self, rdclass, rdtype, covers = dns.rdatatype.NONE):
rds = self.get_rdataset(rdclass, rdtype, covers)
if rds is not None:
self.rdatasets.remove(rds)
def replace_rdataset(self, replacement):
self.delete_rdataset(replacement.rdclass, replacement.rdtype, replacement.covers)
self.rdatasets.append(replacement)